<%@ page import="java.util.List" %>
<%@ page import="com.sdust.model.Book" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>图书列表</title>
    <style>
        body {
            font-family: Arial, sans-serif;
            margin: 20px;
        }
        h2 {
            color: #333;
        }
        table {
            width: 100%;
            border-collapse: collapse;
            margin-top: 20px;
        }
        th, td {
            border: 1px solid #ddd;
            padding: 8px;
            text-align: left;
        }
        th {
            background-color: #f2f2f2;
        }
        form {
            margin-top: 20px;
        }
        a {
            color: #3498db;
            text-decoration: none;
            margin-top: 20px;
            display: inline-block;
        }
    </style>
</head>
<body>
<h2>图书列表</h2>

<!-- 显示图书列表 -->
<table>
    <thead>
    <tr>
        <th>ID</th>
        <th>名称</th>
        <th>作者</th>
        <th>价格</th>
        <th>出版社</th>
        <th>出版日期</th>
        <th>操作</th>
    </tr>
    </thead>
    <tbody>
    <!-- 使用静态的表格数据 -->
    <c:forEach var="book" items="${books}">
        <tr>
            <td>${book.id}</td>
            <td>${book.name}</td>
            <td>${book.author}</td>
            <td>${book.price}</td>
            <td>${book.publisher}</td>
            <td>${book.publish_date}</td>
            <td>
                <form method="post" action="/exp6/book/delete">
                    <input type="hidden" name="bookId" value=${book.id}>
                    <input type="submit" value="删除">
                </form>
            </td>
        </tr>
    </c:forEach>
    <!-- 更多图书行... -->
    </tbody>
</table>

<a href="/exp6/book/addBook.jsp">新增图书</a>
</body>
</html>
